<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Maven问题解决指南 | 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .code-block {
            background-color: #2d3748;
            color: #f8fafc;
            border-radius: 0.5rem;
            overflow-x: auto;
        }
        .solution-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .mermaid-chart {
            background-color: #f7fafc;
            border-radius: 0.5rem;
            padding: 1.5rem;
        }
        .nav-link {
            position: relative;
        }
        .nav-link::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 0;
            height: 2px;
            background-color: #667eea;
            transition: width 0.3s ease;
        }
        .nav-link:hover::after {
            width: 100%;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4">
        <div class="container mx-auto max-w-5xl text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6">Maven问题解决指南</h1>
            <p class="text-xl md:text-2xl opacity-90 mb-8 max-w-3xl mx-auto">Java生态中最流行构建工具的疑难问题解析</p>
            <div class="flex justify-center space-x-4">
                <a href="#dependency-conflict" class="bg-white text-indigo-700 px-6 py-3 rounded-full font-medium hover:bg-gray-100 transition duration-300 flex items-center">
                    <i class="fas fa-project-diagram mr-2"></i> 依赖冲突
                </a>
                <a href="#download-failure" class="bg-indigo-800 text-white px-6 py-3 rounded-full font-medium hover:bg-indigo-900 transition duration-300 flex items-center">
                    <i class="fas fa-cloud-download-alt mr-2"></i> 下载问题
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <div class="container mx-auto max-w-5xl px-4 py-12">
        <!-- Navigation -->
        <div class="bg-white rounded-xl shadow-md p-6 mb-12 sticky top-4 z-10">
            <h2 class="text-xl font-semibold mb-4 text-gray-800">目录导航</h2>
            <div class="flex flex-wrap gap-4">
                <a href="#dependency-conflict" class="nav-link text-indigo-600 hover:text-indigo-800">1. 依赖冲突</a>
                <a href="#download-failure" class="nav-link text-indigo-600 hover:text-indigo-800">2. 下载失败</a>
                <a href="#build-exception" class="nav-link text-indigo-600 hover:text-indigo-800">3. 构建异常</a>
                <a href="#real-world" class="nav-link text-indigo-600 hover:text-indigo-800">4. 实际案例</a>
            </div>
        </div>

        <!-- Dependency Conflict Section -->
        <section id="dependency-conflict" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="bg-indigo-100 text-indigo-800 rounded-full w-12 h-12 flex items-center justify-center mr-4">
                    <i class="fas fa-project-diagram text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">1. 依赖冲突：如何解决版本冲突？</h2>
            </div>
            
            <p class="text-lg text-gray-700 mb-8">依赖冲突是 Maven 项目中最常见的问题之一。当多个依赖引入了相同库的不同版本时，Maven 需要选择一个版本来使用，这可能导致运行时错误或不可预期的行为。</p>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-indigo-100 px-6 py-4">
                        <h3 class="text-xl font-semibold text-indigo-800 flex items-center">
                            <i class="fas fa-search mr-2"></i> 1.1 依赖冲突的原因
                        </h3>
                    </div>
                    <div class="p-6">
                        <ul class="space-y-3 text-gray-700">
                            <li class="flex items-start">
                                <i class="fas fa-arrow-right text-indigo-500 mt-1 mr-2"></i>
                                <span><strong>传递性依赖</strong>：A 依赖 B，B 依赖 C，而 A 也直接依赖 C 的不同版本。</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-arrow-right text-indigo-500 mt-1 mr-2"></i>
                                <span><strong>多模块项目</strong>：不同模块引入了相同库的不同版本。</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-arrow-right text-indigo-500 mt-1 mr-2"></i>
                                <span><strong>第三方库依赖</strong>：第三方库可能依赖了冲突的版本。</span>
                            </li>
                        </ul>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-indigo-100 px-6 py-4">
                        <h3 class="text-xl font-semibold text-indigo-800 flex items-center">
                            <i class="fas fa-bug mr-2"></i> 1.2 如何排查依赖冲突
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">使用 <code class="bg-indigo-100 text-indigo-800 px-2 py-1 rounded">mvn dependency:tree</code> 命令可以查看项目的依赖树，快速定位冲突的依赖：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm"><code>mvn dependency:tree</code></pre>
                        </div>
                        <p class="text-gray-700">输出示例：</p>
                        <div class="code-block p-4 mt-2">
                            <pre class="text-sm"><code>[INFO] com.ts:ts-project:jar:1.0.0
[INFO] +- org.springframework:spring-core:jar:5.3.10:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] \- com.fasterxml.jackson.core:jackson-databind:jar:2.12.3:compile
[INFO]    \- com.fasterxml.jackson.core:jackson-core:jar:2.12.3:compile</code></pre>
                        </div>
                    </div>
                </div>
            </div>
            
            <h3 class="text-2xl font-bold text-gray-800 mb-6 flex items-center">
                <i class="fas fa-tools mr-3"></i> 1.3 解决依赖冲突的方法
            </h3>
            
            <div class="grid md:grid-cols-3 gap-6 mb-8">
                <div class="solution-card bg-white rounded-xl shadow-md p-6 transition duration-300">
                    <div class="bg-blue-100 text-blue-800 rounded-full w-10 h-10 flex items-center justify-center mb-4">
                        <i class="fas fa-ban"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-3 text-gray-800">方法 1：排除冲突的依赖</h4>
                    <p class="text-gray-700 mb-4">在 <code>pom.xml</code> 中使用 <code>&lt;exclusions&gt;</code> 排除不需要的依赖：</p>
                    <div class="code-block p-4">
                        <pre class="text-xs"><code>&lt;dependency&gt;
    &lt;groupId&gt;com.ts&lt;/groupId&gt;
    &lt;artifactId&gt;ts-library&lt;/artifactId&gt;
    &lt;version&gt;1.0.0&lt;/version&gt;
    &lt;exclusions&gt;
        &lt;exclusion&gt;
            &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
            &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
        &lt;/exclusion&gt;
    &lt;/exclusions&gt;
&lt;/dependency&gt;</code></pre>
                    </div>
                </div>
                
                <div class="solution-card bg-white rounded-xl shadow-md p-6 transition duration-300">
                    <div class="bg-green-100 text-green-800 rounded-full w-10 h-10 flex items-center justify-center mb-4">
                        <i class="fas fa-cog"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-3 text-gray-800">方法 2：统一依赖版本</h4>
                    <p class="text-gray-700 mb-4">在父模块的 <code>pom.xml</code> 中使用 <code>&lt;dependencyManagement&gt;</code> 统一管理依赖版本：</p>
                    <div class="code-block p-4">
                        <pre class="text-xs"><code>&lt;dependencyManagement&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
            &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
            &lt;version&gt;3.12.0&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/dependencyManagement&gt;</code></pre>
                    </div>
                </div>
                
                <div class="solution-card bg-white rounded-xl shadow-md p-6 transition duration-300">
                    <div class="bg-purple-100 text-purple-800 rounded-full w-10 h-10 flex items-center justify-center mb-4">
                        <i class="fas fa-chart-bar"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-3 text-gray-800">方法 3：使用 mvn dependency:analyze</h4>
                    <p class="text-gray-700 mb-4"><code>mvn dependency:analyze</code> 命令可以分析项目中未使用或重复的依赖：</p>
                    <div class="code-block p-4">
                        <pre class="text-xs"><code>mvn dependency:analyze</code></pre>
                    </div>
                    <p class="text-gray-700 mt-3 text-sm">根据分析结果，移除不必要的依赖。</p>
                </div>
            </div>
            
            <!-- Mermaid Diagram -->
            <div class="mermaid-chart mb-12">
                <div class="mermaid">
                    graph TD
                        A[依赖冲突] --> B(传递性依赖)
                        A --> C(多模块项目)
                        A --> D(第三方库依赖)
                        B --> E[使用dependency:tree分析]
                        C --> E
                        D --> E
                        E --> F[解决方案]
                        F --> G[排除依赖]
                        F --> H[统一版本]
                        F --> I[依赖分析]
                </div>
            </div>
        </section>

        <!-- Download Failure Section -->
        <section id="download-failure" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="bg-blue-100 text-blue-800 rounded-full w-12 h-12 flex items-center justify-center mr-4">
                    <i class="fas fa-cloud-download-alt text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">2. 下载失败：如何解决依赖下载问题？</h2>
            </div>
            
            <p class="text-lg text-gray-700 mb-8">Maven 依赖下载失败是另一个常见问题，通常由网络问题、仓库配置错误或依赖不存在引起。</p>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-blue-100 px-6 py-4">
                        <h3 class="text-xl font-semibold text-blue-800 flex items-center">
                            <i class="fas fa-search mr-2"></i> 2.1 下载失败的常见原因
                        </h3>
                    </div>
                    <div class="p-6">
                        <ul class="space-y-3 text-gray-700">
                            <li class="flex items-start">
                                <i class="fas fa-wifi text-blue-500 mt-1 mr-2"></i>
                                <span><strong>网络问题</strong>：Maven 中央仓库或私有仓库无法访问。</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-cog text-blue-500 mt-1 mr-2"></i>
                                <span><strong>仓库配置错误</strong>：<code>settings.xml</code> 中配置的仓库地址错误或凭据失效。</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-question-circle text-blue-500 mt-1 mr-2"></i>
                                <span><strong>依赖不存在</strong>：依赖的版本或组 ID 错误，导致无法找到对应的 JAR 文件。</span>
                            </li>
                        </ul>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-blue-100 px-6 py-4">
                        <h3 class="text-xl font-semibold text-blue-800 flex items-center">
                            <i class="fas fa-bug mr-2"></i> 2.2 如何排查下载失败
                        </h3>
                    </div>
                    <div class="p-6">
                        <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-check-circle text-blue-500 mr-2"></i> 步骤 1：检查网络连接
                        </h4>
                        <p class="text-gray-700 mb-4">确保本地网络可以访问 Maven 中央仓库（<code>https://repo.maven.apache.org</code>）或私有仓库。</p>
                        
                        <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-file-alt text-blue-500 mr-2"></i> 步骤 2：检查 settings.xml
                        </h4>
                        <p class="text-gray-700 mb-2"><code>settings.xml</code> 是 Maven 的全局配置文件，通常位于 <code>~/.m2/</code> 目录下。检查以下配置：</p>
                        <ul class="list-disc pl-5 mb-4 text-gray-700">
                            <li><strong>镜像配置</strong>：确保镜像地址正确。</li>
                            <li><strong>仓库凭据</strong>：确保私有仓库的用户名和密码正确。</li>
                        </ul>
                        
                        <div class="code-block p-4 mb-4">
                            <pre class="text-xs"><code>&lt;settings&gt;
    &lt;mirrors&gt;
        &lt;mirror&gt;
            &lt;id&gt;ts-mirror&lt;/id&gt;
            &lt;url&gt;https://maven.ts.com/repository/public/&lt;/url&gt;
            &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
        &lt;/mirror&gt;
    &lt;/mirrors&gt;
    &lt;servers&gt;
        &lt;server&gt;
            &lt;id&gt;ts-repo&lt;/id&gt;
            &lt;username&gt;admin&lt;/username&gt;
            &lt;password&gt;password&lt;/password&gt;
        &lt;/server&gt;
    &lt;/servers&gt;
&lt;/settings&gt;</code></pre>
                        </div>
                        
                        <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-download text-blue-500 mr-2"></i> 步骤 3：手动下载依赖
                        </h4>
                        <p class="text-gray-700">如果某个依赖无法下载，可以尝试手动下载并安装到本地仓库：</p>
                        <div class="code-block p-4 mt-2">
                            <pre class="text-xs"><code>mvn install:install-file -Dfile=path/to/ts-library.jar -DgroupId=com.ts -DartifactId=ts-library -Dversion=1.0.0 -Dpackaging=jar</code></pre>
                        </div>
                    </div>
                </div>
            </div>
            
            <h3 class="text-2xl font-bold text-gray-800 mb-6 flex items-center">
                <i class="fas fa-tools mr-3"></i> 2.3 解决下载失败的方法
            </h3>
            
            <div class="grid md:grid-cols-2 gap-6 mb-8">
                <div class="solution-card bg-white rounded-xl shadow-md p-6 transition duration-300">
                    <div class="bg-yellow-100 text-yellow-800 rounded-full w-10 h-10 flex items-center justify-center mb-4">
                        <i class="fas fa-exchange-alt"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-3 text-gray-800">方法 1：更换仓库镜像</h4>
                    <p class="text-gray-700 mb-4">在 <code>settings.xml</code> 中配置更稳定的镜像：</p>
                    <div class="code-block p-4">
                        <pre class="text-xs"><code>&lt;mirror&gt;
    &lt;id&gt;aliyun&lt;/id&gt;
    &lt;url&gt;https://maven.aliyun.com/repository/public&lt;/url&gt;
    &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
&lt;/mirror&gt;</code></pre>
                    </div>
                </div>
                
                <div class="solution-card bg-white rounded-xl shadow-md p-6 transition duration-300">
                    <div class="bg-red-100 text-red-800 rounded-full w-10 h-10 flex items-center justify-center mb-4">
                        <i class="fas fa-trash-alt"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-3 text-gray-800">方法 2：清理本地仓库</h4>
                    <p class="text-gray-700 mb-4">删除本地仓库中不完整或损坏的依赖文件，重新下载：</p>
                    <div class="code-block p-4">
                        <pre class="text-xs"><code>rm -rf ~/.m2/repository/com/ts/ts-library/
mvn clean install</code></pre>
                    </div>
                </div>
            </div>
            
            <!-- Mermaid Diagram -->
            <div class="mermaid-chart mb-12">
                <div class="mermaid">
                    flowchart LR
                        A[下载失败] --> B{可能原因}
                        B --> C[网络问题]
                        B --> D[配置错误]
                        B --> E[依赖不存在]
                        C --> F[检查网络连接]
                        D --> G[检查settings.xml]
                        E --> H[手动下载]
                        F --> I[更换镜像源]
                        G --> I
                        H --> J[install-file]
                </div>
            </div>
        </section>

        <!-- Build Exception Section -->
        <section id="build-exception" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="bg-red-100 text-red-800 rounded-full w-12 h-12 flex items-center justify-center mr-4">
                    <i class="fas fa-exclamation-triangle text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">3. 构建异常：如何排查构建失败？</h2>
            </div>
            
            <p class="text-lg text-gray-700 mb-8">构建异常是 Maven 项目中最复杂的问题之一，可能由代码错误、插件配置错误或环境问题引起。</p>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-red-100 px-6 py-4">
                        <h3 class="text-xl font-semibold text-red-800 flex items-center">
                            <i class="fas fa-search mr-2"></i> 3.1 构建异常的常见原因
                        </h3>
                    </div>
                    <div class="p-6">
                        <ul class="space-y-3 text-gray-700">
                            <li class="flex items-start">
                                <i class="fas fa-code text-red-500 mt-1 mr-2"></i>
                                <span><strong>代码错误</strong>：编译错误或测试失败。</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-plug text-red-500 mt-1 mr-2"></i>
                                <span><strong>插件配置错误</strong>：插件版本不兼容或配置错误。</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-laptop-code text-red-500 mt-1 mr-2"></i>
                                <span><strong>环境问题</strong>：JDK 版本不匹配或系统资源不足。</span>
                            </li>
                        </ul>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-red-100 px-6 py-4">
                        <h3 class="text-xl font-semibold text-red-800 flex items-center">
                            <i class="fas fa-bug mr-2"></i> 3.2 如何排查构建异常
                        </h3>
                    </div>
                    <div class="p-6">
                        <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-file-alt text-red-500 mr-2"></i> 步骤 1：查看构建日志
                        </h4>
                        <p class="text-gray-700 mb-4">Maven 的构建日志是排查问题的第一手资料。重点关注以下内容：</p>
                        <ul class="list-disc pl-5 mb-4 text-gray-700">
                            <li><strong>错误信息</strong>：如编译错误、测试失败等。</li>
                            <li><strong>堆栈跟踪</strong>：异常堆栈可以帮助定位问题根源。</li>
                        </ul>
                        
                        <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-cube text-red-500 mr-2"></i> 步骤 2：运行单模块构建
                        </h4>
                        <p class="text-gray-700 mb-4">在多模块项目中，可以单独构建某个模块，缩小问题范围：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-xs"><code>mvn clean install -pl ts-module</code></pre>
                        </div>
                        
                        <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-fast-forward text-red-500 mr-2"></i> 步骤 3：跳过测试
                        </h4>
                        <p class="text-gray-700">如果测试失败导致构建失败，可以跳过测试：</p>
                        <div class="code-block p-4 mt-2">
                            <pre class="text-xs"><code>mvn clean install -DskipTests</code></pre>
                        </div>
                    </div>
                </div>
            </div>
            
            <h3 class="text-2xl font-bold text-gray-800 mb-6 flex items-center">
                <i class="fas fa-tools mr-3"></i> 3.3 解决构建异常的方法
            </h3>
            
            <div class="grid md:grid-cols-3 gap-6 mb-8">
                <div class="solution-card bg-white rounded-xl shadow-md p-6 transition duration-300">
                    <div class="bg-green-100 text-green-800 rounded-full w-10 h-10 flex items-center justify-center mb-4">
                        <i class="fas fa-code"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-3 text-gray-800">方法 1：修复代码错误</h4>
                    <p class="text-gray-700">根据编译错误或测试失败信息，修复代码中的问题。</p>
                </div>
                
                <div class="solution-card bg-white rounded-xl shadow-md p-6 transition duration-300">
                    <div class="bg-blue-100 text-blue-800 rounded-full w-10 h-10 flex items-center justify-center mb-4">
                        <i class="fas fa-plug"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-3 text-gray-800">方法 2：调整插件配置</h4>
                    <p class="text-gray-700 mb-4">检查<code>pom.xml</code> 中的插件配置，确保版本兼容且配置正确：</p>
                    <div class="code-block p-4">
                        <pre class="text-xs"><code>&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
    &lt;version&gt;3.8.1&lt;/version&gt;
    &lt;configuration&gt;
        &lt;source&gt;1.8&lt;/source&gt;
        &lt;target&gt;1.8&lt;/target&gt;
    &lt;/configuration&gt;
&lt;/plugin&gt;</code></pre>
                    </div>
                </div>
                
                <div class="solution-card bg-white rounded-xl shadow-md p-6 transition duration-300">
                    <div class="bg-purple-100 text-purple-800 rounded-full w-10 h-10 flex items-center justify-center mb-4">
                        <i class="fas fa-arrow-up"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-3 text-gray-800">方法 3：升级 Maven 版本</h4>
                    <p class="text-gray-700 mb-4">如果问题由 Maven 本身的 Bug 引起，可以尝试升级到最新版本：</p>
                    <div class="code-block p-4">
                        <pre class="text-xs"><code>mvn -v</code></pre>
                    </div>
                    <p class="text-gray-700 mt-3 text-sm">下载并安装最新版本的 Maven。</p>
                </div>
            </div>
        </section>

        <!-- Real World Section -->
        <section id="real-world" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="bg-purple-100 text-purple-800 rounded-full w-12 h-12 flex items-center justify-center mr-4">
                    <i class="fas fa-laptop-code text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">4. 实际项目中的应用</h2>
            </div>
            
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-indigo-100 px-6 py-4">
                        <h3 class="text-xl font-semibold text-indigo-800">4.1 依赖冲突的典型案例</h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">在 <code>ts-project</code> 中，<code>ts-module-a</code> 依赖 <code>commons-lang3:3.12.0</code>，而 <code>ts-module-b</code> 依赖 <code>commons-lang3:3.11.0</code>，导致运行时异常。</p>
                        <p class="text-gray-700">通过 <code>mvn dependency:tree</code> 发现冲突后，使用 <code>&lt;dependencyManagement&gt;</code> 统一版本。</p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-blue-100 px-6 py-4">
                        <h3 class="text-xl font-semibold text-blue-800">4.2 下载失败的典型案例</h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">在 <code>ts-project</code> 中，私有仓库的凭据失效，导致依赖下载失败。</p>
                        <p class="text-gray-700">通过检查 <code>settings.xml</code> 并更新凭据，问题得以解决。</p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="bg-red-100 px-6 py-4">
                        <h3 class="text-xl font-semibold text-red-800">4.3 构建异常的典型案例</h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">在 <code>ts-project</code> 中，<code>maven-surefire-plugin</code> 的版本过低，导致测试失败。</p>
                        <p class="text-gray-700">通过升级插件版本并调整配置，问题得以解决。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Summary Section -->
        <section class="bg-indigo-50 rounded-xl p-8 mb-12">
            <h2 class="text-2xl font-bold text-indigo-800 mb-6 text-center">Maven问题解决速查表</h2>
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-white p-6 rounded-lg shadow-sm">
                    <h3 class="text-lg font-semibold text-indigo-700 mb-3 flex items-center">
                        <i class="fas fa-project-diagram mr-2"></i> 依赖冲突
                    </h3>
                    <ul class="text-gray-700 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span>使用 <code>dependency:tree</code> 分析</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span>排除不需要的依赖</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span>统一版本管理</span>
                        </li>
                    </ul>
                </div>
                
                <div class="bg-white p-6 rounded-lg shadow-sm">
                    <h3 class="text-lg font-semibold text-blue-700 mb-3 flex items-center">
                        <i class="fas fa-cloud-download-alt mr-2"></i> 下载失败
                    </h3>
                    <ul class="text-gray-700 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span>检查网络连接</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span>验证 settings.xml</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span>更换镜像源</span>
                        </li>
                    </ul>
                </div>
                
                <div class="bg-white p-6 rounded-lg shadow-sm">
                    <h3 class="text-lg font-semibold text-red-700 mb-3 flex items-center">
                        <i class="fas fa-exclamation-triangle mr-2"></i> 构建异常
                    </h3>
                    <ul class="text-gray-700 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span>检查构建日志</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span>调整插件配置</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span>升级Maven版本</span>
                        </li>
                    </ul>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8">
        <div class="container mx-auto px-4 text-center">
            <h3 class="text-xl font-semibold mb-2">技术小馆</h3>
            <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300">
                <i class="fas fa-globe mr-1"></i> http://www.yuque.com/jtostring
            </a>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            },
            themeVariables: {
                primaryColor: '#f7fafc',
                primaryTextColor: '#2d3748',
                primaryBorderColor: '#cbd5e0',
                lineColor: '#4a5568',
                secondaryColor: '#e2e8f0',
                tertiaryColor: '#f7fafc'
            }
        });
    </script>
</body>
</html>